/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipo.mm.web.filters;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 *
 * @author makcro
 */
public class EncodingFilter implements Filter {

    private String encodingUTF = "utf-8";
    private String encodingISO88592 = "ISO-8859-2";

    public void init(FilterConfig filterConfig) throws ServletException {
//        String encodingParam = filterConfig.getInitParameter("encoding");
//        if (encodingParam != null) {
//            encoding = encodingParam;
//        }
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding(encodingUTF);
        response.setCharacterEncoding(encodingUTF);
        chain.doFilter(request, response);
    }

    public void destroy() {
    }
}
